package com.jindu.producer.system.model;

import org.hibernate.annotations.DynamicInsert;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Objects;

@Entity
@DynamicInsert
@Table(name = "s_user_log", schema = "alpha-platform", catalog = "")
public class SUserLogEntity implements Serializable {
    @Id
    private String id;
    private String account;
    private String userId;
    private Timestamp logTime;
    private String operation;
    private Integer type;
    private String userIp;
    private Integer successFlag;
    private Integer loginPlatform;

    @Id
    @Column(name = "id", nullable = false, length = 36)
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Basic
    @Column(name = "account", nullable = true, length = 50)
    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    @Basic
    @Column(name = "user_id", nullable = true, length = 36)
    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "log_time", nullable = true)
    public Timestamp getLogTime() {
        return logTime;
    }

    public void setLogTime(Timestamp logTime) {
        this.logTime = logTime;
    }

    @Basic
    @Column(name = "operation", nullable = true, length = 200)
    public String getOperation() {
        return operation;
    }

    public void setOperation(String operation) {
        this.operation = operation;
    }

    @Basic
    @Column(name = "type", nullable = true)
    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    @Basic
    @Column(name = "user_ip", nullable = true, length = 20)
    public String getUserIp() {
        return userIp;
    }

    public void setUserIp(String userIp) {
        this.userIp = userIp;
    }

    @Basic
    @Column(name = "success_flag", nullable = true)
    public Integer getSuccessFlag() {
        return successFlag;
    }

    public void setSuccessFlag(Integer successFlag) {
        this.successFlag = successFlag;
    }

    @Basic
    @Column(name = "login_platform", nullable = true)
    public Integer getLoginPlatform() {
        return loginPlatform;
    }

    public void setLoginPlatform(Integer loginPlatform) {
        this.loginPlatform = loginPlatform;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SUserLogEntity that = (SUserLogEntity) o;
        return Objects.equals(id, that.id) &&
                Objects.equals(account, that.account) &&
                Objects.equals(userId, that.userId) &&
                Objects.equals(logTime, that.logTime) &&
                Objects.equals(operation, that.operation) &&
                Objects.equals(type, that.type) &&
                Objects.equals(userIp, that.userIp) &&
                Objects.equals(successFlag, that.successFlag) &&
                Objects.equals(loginPlatform, that.loginPlatform);
    }

    @Override
    public int hashCode() {

        return Objects.hash(id, account, userId, logTime, operation, type, userIp, successFlag, loginPlatform);
    }
}
